<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title>Floor View</title>
<script src="/js/websocket.js"></script>
<script src="/js/jquery.min.js"></script>
<script src="/js/sockjs.min.js"></script>
<script src="/js/stomp.min.js"></script>
<script id="code">
    var DEBUG_FLAG = true;
    var fromUserId = GetQueryString("userId");
    $(function()
    {
        //启动websocket
        //connect();
    });
    function userConnect(){
      var selfId = $("#selfId").val();
      connect(selfId);
    }
    function  userDisConnect() {
      disconnect()
    }
    function send() {
      var msg = $("#msg").val();
      stompClient.send("/app/send", {}, msg);
    }
    function sendToUser() {
      var msg = $("#msg").val();
      var toUserId = $("#userId").val();
      stompClient.send("/app/sendToUser", {}, JSON.stringify({msg, fromUserId, toUserId}));
    }
</script>
</head>

<body style="margin: 0px;padding: 0px;overflow: hidden; ">
  <div>
    用户id：<input type="text" id="selfId">
    <div><input type="button" value="连接" onclick="userConnect()"></input></div>
    <div><input type="button" value="断开" onclick="userDisConnect()"></input></div>
  </div>
  <!-- 显示消息-->
  <textarea id="debuggerInfo" style="width:100%;height:200px;"></textarea>
  <div>用户id：<input type="text" id="userId"></input></div>
  <!-- 发送消息-->
  <div>消息：<input type="text" id="msg"></input></div>
  <div><input type="button" value="发送消息" onclick="send()"></input></div>
  <div><input type="button" value="向指定人发送消息" onclick="sendToUser()"></input></div>
</body>
</html>
